常见的几个错误在chromium源码中列出来了
1 | const char kWarningUnmuteFailed[] = |
文档 写的相对比较清楚,三个条件
- 静音的自动播放都可以
- 带声音的播放有条件
- 用户在当前域名有交互(点击、触摸等等)的可以自动播
- 在桌面端的Chrome中,符合用户偏好历史的可以自动播,在 chrome://media-engagement/ 可以看
- 移动端用户加入首屏的站点或者桌面端已安装的PWA可以自动播
- 顶层的Frame可以允许子级iframe的带声音自动播放,用
iframe
的allow="autoplay"
属性,前提是顶层frame满足带声音播放的条件
检测方法
最后更新: 2022年03月02日 03:32
原始链接: http://rawbin-.github.io/browser/2018-12-13-chrome-autoplay/